//
//  PersonInfoReviewController.m
//  easystudy
//
//  Created by kane on 16/9/1.
//  Copyright © 2016年 kane. All rights reserved.
//

#import "PersonInfoReviewController.h"

@interface PersonInfoReviewController ()<UIScrollViewDelegate>
{
    __weak IBOutlet UIScrollView *contentScroll;
    __weak IBOutlet UIImageView *topIV;
    __weak IBOutlet UIButton *avatarBtn;
    __weak IBOutlet UILabel *photoCountLbl;
    __weak IBOutlet UILabel *cityLbl;
    __weak IBOutlet UILabel *jobLbl;
    __weak IBOutlet UILabel *schoolLbl;
    __weak IBOutlet UILabel *companyLbl;
    __weak IBOutlet UILabel *ageLbl;
    __weak IBOutlet UILabel *starLbl;
    __weak IBOutlet UILabel *emotionLbl;
    __weak IBOutlet UILabel *interestLbl;
    __weak IBOutlet UILabel *descLbl;
    __weak IBOutlet UILabel *nickName;
    __weak IBOutlet UILabel *signLbl;
    
}

@end

@implementation PersonInfoReviewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [avatarBtn drawCornerRadius:avatarBtn.width/2];
    contentScroll.contentSize = CGSizeMake(fWidth_Current, 650);
    cityLbl.text = _dataInfo[@"area"];
    jobLbl.text =_dataInfo[@"occupation"];
    schoolLbl.text =_dataInfo[@"school"];
    companyLbl.text =_dataInfo[@"company"];
    ageLbl.text =_dataInfo[@"age"];
    starLbl.text =_dataInfo[@"constellation"];
    emotionLbl.text =_dataInfo[@"isMarried"];
    interestLbl.text =_dataInfo[@"interest"];
    descLbl.text =_dataInfo[@"introduce"];
    nickName.text =_dataInfo[@"nickname"];
    if (![_dataInfo[@"sign"] isEqualToString: @""]) {
        signLbl.text =_dataInfo[@"sign"];
    }
}

- (IBAction)backBtnPressed:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.y < 0) {
        CGFloat offsetY = 0-scrollView.contentOffset.y;
        if (offsetY < 140) {
            topIV.frame = (CGRect){0,offsetY/2 -70,fWidth_Current,fWidth_Current};
        }else{
            CGFloat distance = 70-offsetY/2;
            CGFloat width = fWidth_Current - 2*distance;
            topIV.frame = (CGRect){distance,0,width,width};
        }
    }
}

@end
